package com.huawei.hms.framework.network.restclient.hwhttp;

import com.huawei.hms.framework.common.StringUtils;
import com.huawei.hms.framework.network.restclient.hwhttp.trans.ByteString;
import java.io.IOException;
import java.io.OutputStream;
import javax.annotation.Nullable;

class RequestBody$4 extends RequestBody {
    final /* synthetic */ ByteString val$content;
    final /* synthetic */ MediaType val$contentType;

    RequestBody$4(MediaType mediaType, ByteString byteString) {
        this.val$contentType = mediaType;
        this.val$content = byteString;
    }

    public byte[] body() {
        return new byte[0];
    }

    @Nullable
    public String contentType() {
        return this.val$contentType == null ? null : this.val$contentType.toString();
    }

    public void writeTo(OutputStream outputStream) throws IOException {
        outputStream.write(StringUtils.getBytes(this.val$content.utf8()));
    }

    public long contentLength() throws IOException {
        return (long) this.val$content.size();
    }
}
